import { ref, computed } from "vue";

const useCounter = (n) => {
  // 功能1
  const count = ref(n);
  const add = () => {
    count.value++;
  };
  const minus = () => {
    count.value--;
  };
  const doubleCount = computed(() => {
    return count.value * 2;
  });

  return [count, add, minus, doubleCount];
};

export default useCounter;
